<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function show(){
				var $uid=uid.value;
				if(!$uid){alert("请输入正确的id");return}
				var xhr=new XMLHttpRequest();
				xhr.onreadystatechange=function(){
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
             //d1.innerHTML=r;					
						var arr=JSON.parse(r);
						//console.log(r);
						
						
						str=`
						    <table border=1 cellpadding="" cellspacing="0">
						    	<tr>
						    		<th>编号</th>
						    		<th>用户</th>
						    		<th>密码</th>
						    		<th>邮箱</th>
						    		<th>电话</th>
						    		<th>头像</th>
						    		<th>真实姓名</th>
						    		<th>姓名</th>
						    	</tr>
						`;
						
						for(var gender="不详",i=0;i<arr.length;i++){
							if(arr[i].gender==1){
								  gender="男";
							}else{
								gender="女";
							}
						str+=`
							   <tr>
							    <td>${arr[i].uid}</td>
							    <td>${arr[i].uname}</td>
							    <td>${arr[i].upwd}</td>
							    <td>${arr[i].emali}</td>
							    <td>${arr[i].phone}</td>
							    <td>${arr[i].avatar}</td>
							    <td>${arr[i].user_name}</td>
							    <td>${gender}</td>
							   </tr>
							
							`;
						}
						str+=`</table>`;
						d1.innerHTML=str;
					}
					
				}
				xhr.open("get",`/pro/v1/search?uid=${$uid}`,true);
				xhr.send();
			}
		</script>
	</head>
	<body>
		<input type="text" id="uid">
		<button onclick="show()"> 查找</button >
		<div id="d1">
			
		</div>
	</body>
</html>
